#ifndef __VGDB_SERVER_H_
#define __VGDB_SERVER_H_

#include <arpa/inet.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <netdb.h> 
#include <netinet/in.h>
#include <regex.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ipc.h>
#include <sys/select.h>
#include <sys/shm.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <termios.h>
#include <unistd.h>

#define VGDB_MBUFF_LINE_LEN    128
#define VGDB_MBUFF_LINE_NR     128
#define VGDB_FILE_NAME_LEN     128

#define VGDB_GVIM_RUN   0
#define VGDB_GVIM_QUIT  1
#define VGDB_GVIM_STOP  2

#define VGDB_GDB_RUN    0
#define VGDB_GDB_QUIT   1
#define VGDB_GDB_STOP   2

#define VGDB_STOP       0

typedef struct {
    pid_t           gdb_pid;
    pid_t           gvim_pid;

    int             gdb_rwfd;
    int             gvim_socket;

    int             gvim_state;
    int             gdb_state;
    int             state;

    char            mline_buff[VGDB_MBUFF_LINE_LEN*VGDB_MBUFF_LINE_NR];
    int             mline_cols;
    int             mline_blen;
    int             mline_bnr;

    char            current_file[VGDB_FILE_NAME_LEN];
    char            debug_file[VGDB_FILE_NAME_LEN];
    int             file_name_len;
    int             current_offset;

    int             source_win_id;
    int             message_seqno;
}vgdb_server;



int vgdb_server_run(vgdb_server*);

#endif
